const Gtk = imports.gi.Gtk;
const St = imports.gi.St;
const Lang = imports.lang;
+const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
const Tweener = imports.ui.tweener;
};
const DRAG_CURSOR_MAP = {
- 0: Shell.Cursor.DND_UNSUPPORTED_TARGET,
- 1: Shell.Cursor.DND_COPY,
- 2: Shell.Cursor.DND_MOVE
+ 0: Meta.Cursor.DND_UNSUPPORTED_TARGET,
+ 1: Meta.Cursor.DND_COPY,
+ 2: Meta.Cursor.DND_MOVE
};
const DragDropResult = {
if (this._onEventId)
this._ungrabActor();
this._grabEvents();
- global.set_cursor(Shell.Cursor.DND_IN_DRAG);
+ global.screen.set_cursor(Meta.Cursor.DND_IN_DRAG);
this._dragX = this._dragStartX = stageX;
this._dragY = this._dragStartY = stageY;
if (motionFunc) {
let result = motionFunc(dragEvent);
if (result != DragMotionResult.CONTINUE) {
- global.set_cursor(DRAG_CURSOR_MAP[result]);
+ global.screen.set_cursor(DRAG_CURSOR_MAP[result]);
return false;
}
}
targY,
0);
if (result != DragMotionResult.CONTINUE) {
- global.set_cursor(DRAG_CURSOR_MAP[result]);
+ global.screen.set_cursor(DRAG_CURSOR_MAP[result]);
return false;
}
}
target = target.get_parent();
}
- global.set_cursor(Shell.Cursor.DND_IN_DRAG);
+ global.screen.set_cursor(Meta.Cursor.DND_IN_DRAG);
return false;
},
}
this._dragInProgress = false;
- global.unset_cursor();
+ global.screen.set_cursor(Meta.Cursor.DEFAULT);
this.emit('drag-end', event.get_time(), true);
this._dragComplete();
return true;
let [snapBackX, snapBackY, snapBackScale] = this._getRestoreLocation();
if (this._actorDestroyed) {
- global.unset_cursor();
+ global.screen.set_cursor(Meta.Cursor.DEFAULT);
if (!this._buttonDown)
this._dragComplete();
this.emit('drag-end', eventTime, false);
} else {
dragActor.destroy();
}
- global.unset_cursor();
+ global.screen.set_cursor(Meta.Cursor.DEFAULT);
this.emit('drag-end', eventTime, false);
this._animationInProgress = false;
let urlId = this._findUrlAtPos(event);
if (urlId != -1 && !this._cursorChanged) {
- global.set_cursor(Shell.Cursor.POINTING_HAND);
+ global.screen.set_cursor(Meta.Cursor.POINTING_HAND);
this._cursorChanged = true;
} else if (urlId == -1) {
- global.unset_cursor();
+ global.screen.set_cursor(Meta.Cursor.DEFAULT);
this._cursorChanged = false;
}
return false;
if (this._cursorChanged) {
this._cursorChanged = false;
- global.unset_cursor();
+ global.screen.set_cursor(Meta.Cursor.DEFAULT);
}
}));
},
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
+const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
const St = imports.gi.St;
if (!Main.pushModal(this._group) || this._group.visible)
return;
- global.set_cursor(Shell.Cursor.CROSSHAIR);
+ global.screen.set_cursor(Meta.Cursor.CROSSHAIR);
this._group.visible = true;
},
function() {
Main.popModal(this._group);
this._group.destroy();
- global.unset_cursor();
+ global.screen.set_cursor(Meta.Cursor.DEFAULT);
this.emit('finished', geometry);
})
#include <meta/display.h>
#include <meta/util.h>
#include <meta/meta-shaped-texture.h>
+#include <meta/meta-cursor-tracker.h>
/* Memory report bits */
#ifdef HAVE_MALLINFO
meta_set_stage_input_region (screen, global->input_region);
}
-/**
- * shell_global_set_cursor:
- * @global: A #ShellGlobal
- * @type: the type of the cursor
- *
- * Set the cursor on the stage window.
- */
-void
-shell_global_set_cursor (ShellGlobal *global,
- ShellCursor type)
-{
- const char *name;
- GdkCursor *cursor;
-
- switch (type)
- {
- case SHELL_CURSOR_DND_IN_DRAG:
- name = "dnd-none";
- break;
- case SHELL_CURSOR_DND_MOVE:
- name = "dnd-move";
- break;
- case SHELL_CURSOR_DND_COPY:
- name = "dnd-copy";
- break;
- case SHELL_CURSOR_DND_UNSUPPORTED_TARGET:
- name = "dnd-none";
- break;
- case SHELL_CURSOR_POINTING_HAND:
- name = "hand";
- break;
- case SHELL_CURSOR_CROSSHAIR:
- name = "crosshair";
- break;
- default:
- g_return_if_reached ();
- }
-
- cursor = gdk_cursor_new_from_name (global->gdk_display, name);
- if (!cursor)
- {
- GdkCursorType cursor_type;
- switch (type)
- {
- case SHELL_CURSOR_DND_IN_DRAG:
- cursor_type = GDK_FLEUR;
- break;
- case SHELL_CURSOR_DND_MOVE:
- cursor_type = GDK_TARGET;
- break;
- case SHELL_CURSOR_DND_COPY:
- cursor_type = GDK_PLUS;
- break;
- case SHELL_CURSOR_POINTING_HAND:
- cursor_type = GDK_HAND2;
- break;
- case SHELL_CURSOR_CROSSHAIR:
- cursor_type = GDK_CROSSHAIR;
- break;
- case SHELL_CURSOR_DND_UNSUPPORTED_TARGET:
- cursor_type = GDK_X_CURSOR;
- break;
- default:
- g_return_if_reached ();
- }
- cursor = gdk_cursor_new (cursor_type);
- }
-
- gdk_window_set_cursor (global->stage_gdk_window, cursor);
-
- g_object_unref (cursor);
-}
-
-/**
- * shell_global_unset_cursor:
- * @global: A #ShellGlobal
- *
- * Unset the cursor on the stage window.
- */
-void
-shell_global_unset_cursor (ShellGlobal *global)
-{
- gdk_window_set_cursor (global->stage_gdk_window, NULL);
-}
-
/**
* shell_global_set_stage_input_region:
* @global: the #ShellGlobal
void shell_global_set_stage_input_region (ShellGlobal *global,
GSList *rectangles);
-/* X utilities */
-typedef enum {
- SHELL_CURSOR_DND_IN_DRAG,
- SHELL_CURSOR_DND_UNSUPPORTED_TARGET,
- SHELL_CURSOR_DND_MOVE,
- SHELL_CURSOR_DND_COPY,
- SHELL_CURSOR_POINTING_HAND,
- SHELL_CURSOR_CROSSHAIR
-} ShellCursor;
-
-void shell_global_set_cursor (ShellGlobal *global,
- ShellCursor type);
-void shell_global_unset_cursor (ShellGlobal *global);
-
void shell_global_get_pointer (ShellGlobal *global,
int *x,
int *y,